package com.hjj.test;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;

@Slf4j
@SpringBootApplication
public class SpringHjjTestApplication {
    public static void main(String[] args) {
        try {
            ConfigurableApplicationContext application = SpringApplication.run(SpringHjjTestApplication.class, args);
            Environment env = application.getEnvironment();
            String ip = InetAddress.getLocalHost().getHostAddress();
            String port = env.getProperty("server.port");
            String path = env.getProperty("server.servlet.context-path", "").trim();
            log.info("\n----------------------------------------------------------------\n" +
                    "Swagger文档地址: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
                    "----------------------------------------------------------------");
            System.out.println("程序启动成功");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("程序启动失败");
        }
    }

}
